package stage
{
	import flash.display.*;
	
	import mx.collections.ArrayCollection;
	
	/**
	 * This class is mainly used to handle the image resource
	 * @author power
	 */
	public final class ResourceManager
	{
		[Embed(source="../images/point.png")]
		public static var BrownPlane:Class;
		public static var BrownPlaneGraphics:GraphicsResource = new GraphicsResource(new BrownPlane());
		
		[Embed(source="../images/tank.png")]
		public static var Tank:Class;
		public static var TankGraphics:GraphicsResource=new GraphicsResource(new Tank());
		
		[Embed(source="../images/greenSensor.png")]
		public static var DisableSensor:Class;
		public static var DisableSensorGraphics:GraphicsResource=new GraphicsResource(new DisableSensor());
		
		[Embed(source="../images/redSensor.png")]
		public static var EnableSensor:Class;
		public static var EnableSensorGraphics:GraphicsResource=new GraphicsResource(new EnableSensor());
		
		[Embed(source="../images/pressure_small.png")]
		public static var PressureSensor:Class;
		public static var PressureSensorGraphics:GraphicsResource=new GraphicsResource(new PressureSensor());
		
		[Embed(source="../images/sound_small.png")]
		public static var SoundSensor:Class;
		public static var SoundSensorGraphics:GraphicsResource=new GraphicsResource(new SoundSensor());
		
		[Embed(source="../images/fog_sensor.png")]
		public static var FogSensor:Class;
		public static var FogSensorGraphics:GraphicsResource=new GraphicsResource(new FogSensor());
		
		[Embed(source="../images/infrared_small.png")]
		public static var InfraredSensor:Class;
		public static var InfraredSensorGraphics:GraphicsResource=new GraphicsResource(new InfraredSensor());
		
		[Embed(source="../images/vedio_sensor.png")]
		public static var VedioSensor:Class;
		public static var VedioSensorGraphics:GraphicsResource=new GraphicsResource(new VedioSensor());
		
		[Embed(source="../images/metal_small.png")]
		public static var MetalSensor:Class;
		public static var MetalSensorGraphics:GraphicsResource=new GraphicsResource(new MetalSensor());
		
		[Embed(source="../images/rfid_small.png")]
		public static var RfidReader:Class;
		public static var RfidReaderGraphics:GraphicsResource=new GraphicsResource(new RfidReader());
		
		[Embed(source="../images/sandtable_background_white.png")]
		public static var SandTableBackground:Class;
		
		[Embed(source="../images/red_arrow.png")]
		public static var InvadeArrow:Class;
		
		[Embed(source="../images/vibrate_30.png")]
		public static var VibrateSensor:Class;
		
		[Embed(source="../images/infra_nimbus_small.png")]
		public static var InfraNimbusSmall:Class;
		
		[Embed(source="../images/infra_nimbus_big.png")]
		public static var InfraNimbusBig:Class;
		
		[Embed(source="../images/sound_nimbus_small.png")]
		public static var SoundNimbusSmall:Class;
		
		[Embed(source="../images/sound_nimbus_big.png")]
		public static var SoundNimbusBig:Class;
		
		[Embed(source="../images/pressure_nimbus_small.png")]
		public static var PressureNimbusSmall:Class;
		
		[Embed(source="../images/pressure_nimbus_big.png")]
		public static var PressureNimbusBig:Class;
		
		[Embed(source="../images/metal_nimbus_small.png")]
		public static var MetalNimbusSmall:Class;
		
		[Embed(source="../images/metal_nimbus_big.png")]
		public static var MetalNimbusBig:Class;
		
		[Embed(source="../images/rfid_nimbus_small.png")]
		public static var RfidNimbusSmall:Class;
		
		[Embed(source="../images/rfid_nimbus_big.png")]
		public static var RfidNimbusBig:Class;
		
		[Embed(source="../images/vibrate_nimbus_small.png")]
		public static var VibrateNimbusSmall:Class;
		
		[Embed(source="../images/vibrate_nimbus_big.png")]
		public static var VibrateNimbusBig:Class;

		public static var STR_SEPERATOR:String="\n"; 
				
		public static var MSG_UNKNOWN:String="发现不明敌方物体入侵监控区域";
		
		public static var MSG_ENEMY_TANK:String="发现敌方坦克";
		
		public static var MSG_OUR_TANK:String="我方坦克出动进行反击";
		
		
		
		//scenary 1
		public static var MSG_SUBJECT_INTRADE:String="<font color='#FF0000'>红外传感器</font>发现物体入侵";
		
		public static var MSG_IDENTYFY_AS_TANK:String="<font color='#FF0000'>声音传感器</font>将物体识别为坦克";
		
		public static var MSG_ENEMY_TANK_LEAVE:String="<font color='#FF0000'>红外传感器</font>发现敌方坦克离开";
		
		public static var MSG_READ_RFID_INFORMATION:String="<font color='#FF0000'>RFID读卡器</font>读取我方坦克信息：";
		
		
		//scenary 2
		//public static var 
		
		
		public static var LABEL_RFIDINFOBOX:String="RFID传感器";
		
		public static var LABEL_INFRARED:String="红外传感器";
		
		public static var LABEL_METAL:String="金属传感器";
		
		public static var LABEL_PRESSURE:String="压力传感器";
		
		public static var LABEL_SOUND:String="声音传感器";
		
		public static var LABEL_VIBRATE:String="震动传感器";
		
		public static function getSensorLabel(type:int):String
		{
			if(type==AppConstant.TYPE_METAL_SENSOR)
			{
				return LABEL_METAL;
			}
			else if(type==AppConstant.TYPE_VIBRATE_SENSOR)
			{
				return LABEL_VIBRATE;
			}
			else if(type==AppConstant.TYPE_PRESSURE_SENSOR)
			{
				return LABEL_PRESSURE;
			}
			return null;
		}		
		
		public static function getBigNumClass(type:int):Class
		{
			if(type==AppConstant.TYPE_INFRARED_SENSOR)
			
				return ResourceManager.InfraNimbusBig;
			else if(type==AppConstant.TYPE_PRESSURE_SENSOR)
				return ResourceManager.PressureNimbusBig;
			else if(type==AppConstant.TYPE_METAL_SENSOR)
				return ResourceManager.MetalNimbusBig;
			else if(type==AppConstant.TYPE_SOUND_SENSOR)
				return ResourceManager.SoundNimbusBig;
			else if(type==AppConstant.TYPE_VIBRATE_SENSOR)
				return ResourceManager.VibrateNimbusBig;
			else if(type==AppConstant.TYPE_RFID_READER)
				return ResourceManager.RfidNimbusBig;
			else 
				return ResourceManager.InfraNimbusBig;
				
		}
		
		public static function getSmallNumClass(type:int):Class
		{
			if(type==AppConstant.TYPE_INFRARED_SENSOR)
			
				return ResourceManager.InfraNimbusSmall;
			else if(type==AppConstant.TYPE_PRESSURE_SENSOR)
				return ResourceManager.PressureNimbusSmall;
			else if(type==AppConstant.TYPE_METAL_SENSOR)
				return ResourceManager.MetalNimbusSmall;
			else if(type==AppConstant.TYPE_SOUND_SENSOR)
				return ResourceManager.SoundNimbusSmall;
			else if(type==AppConstant.TYPE_VIBRATE_SENSOR)
				return ResourceManager.VibrateNimbusSmall;
			else if(type==AppConstant.TYPE_RFID_READER)
				return ResourceManager.RfidNimbusSmall;
			else
				return ResourceManager.InfraNimbusSmall;
		}
		public static function getCombinedInfo(types:ArrayCollection):String
		{
			var sensorNames:Array=new Array();
			for(var i:int;i<types.length;i++)
			{
				var type:int=types.getItemAt(i) as int;
				if(type==AppConstant.TYPE_METAL_SENSOR)
				{
					sensorNames.push(LABEL_METAL);
				}
				else if(type==AppConstant.TYPE_VIBRATE_SENSOR)
				{
					sensorNames.push(LABEL_VIBRATE);
				}
				else if(type==AppConstant.TYPE_PRESSURE_SENSOR)
				{
					sensorNames.push(LABEL_PRESSURE);
				}
			}
			return "<font color='#FF0000'>"+sensorNames.join(",")+"</font>";
		}
		public static function getImageClass(type:int):Class
		{
			if (type == AppConstant.TYPE_FOG_SENSOR)
			{
				return ResourceManager.FogSensor;
			}
			else if (type == AppConstant.TYPE_INFRARED_SENSOR)
			{
				return ResourceManager.InfraredSensor;
			}
			else if (type == AppConstant.TYPE_PRESSURE_SENSOR)
			{
				return ResourceManager.PressureSensor;
			}
			else if (type == AppConstant.TYPE_SOUND_SENSOR)
			{
				return ResourceManager.SoundSensor;
			}
			else if (type == AppConstant.TYPE_VEDIO_SENSOR)
			{
				return ResourceManager.VedioSensor;
			}
			else if (type == AppConstant.TYPE_TANK)
			{
				return ResourceManager.Tank;
			}
			else if(type==AppConstant.TYPE_METAL_SENSOR)
			{
				return ResourceManager.MetalSensor;
			}
			else if(type==AppConstant.TYPE_RFID_READER)
			{
				return ResourceManager.RfidReader;
			}
			else if(type==AppConstant.TYPE_VIBRATE_SENSOR)
			{
				return ResourceManager.VibrateSensor;
			}
			return null;
		}
		
		
	}
}